﻿using System.ComponentModel.Composition;
using Cubicle.Core.Interfaces;

namespace Cubicle.Core.Processors.Parameter
{
    [Export("Cubicle.Processors.Parameter.ParameterIterator", typeof(IProcessor<ParameterRequest>))]
    [ExportMetadata("Name", "ParameterIterator")]
    [ExportMetadata("Description", "Iteration stops when parameter resolution Completes/Fails or the queue is depleted.")]
    public class ParameterIterator : ConditionalQueue<ParameterRequest>
    {
        public override bool Condition(ParameterRequest input)
        {
            return !(input.ReqType == RequestType.Completed || input.ReqType == RequestType.Failed);
        }
    }
}